package com.bt.lms.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 连接工具
 *
 * @author 李鹏
 */
public class ConnectUtils {

    public static Connection connect() {

        try {
            //jdbc五步：1.加载驱动
            Class.forName("com.mysql.cj.jdbc.Driver");
            //2.获取连接
            String url = "jdbc:mysql://rm-cn-zxu39exkm001edxo.rwlb.rds.aliyuncs.com:3306/bot_lms?serverTimezone=UTC";
            String userName = "root";
            String psw = "Bot-417-1";
            Connection connection = DriverManager.getConnection(url, userName, psw);

            return connection;

        } catch (ClassNotFoundException ex) {
            throw new RuntimeException(ex);
        } catch (SQLException ex) {
            throw new RuntimeException(ex);
        }
    }

}

